#include "cppTutorSingleton.h"

#include <iostream>

using namespace std;

bool CcppTutorSingleton :: instanceFlag = false;  
CcppTutorSingleton* CcppTutorSingleton :: single = NULL;  

CcppTutorSingleton :: CcppTutorSingleton()
{  
	//private constructor  
}  

// public destructor
CcppTutorSingleton :: ~CcppTutorSingleton() 
{  
	instanceFlag = false;  
}  

CcppTutorSingleton* CcppTutorSingleton :: getInstance() {  
   if(! instanceFlag) {  
       single = new CcppTutorSingleton();  
       instanceFlag = true;  
       return single;  
   }  
   else {  
       return single;  
   }  
}  
  
void CcppTutorSingleton :: method() {  
   cout << "Method of the singleton class" << endl;  
cout << "instanceFlag : " << instanceFlag << endl;  
} 
